package org.weishe.hbase.department;

import java.util.Date;

import org.junit.Test;

import com.xuexi.hbase.HBaseDBHelper;

public class Department {
	// private HBaseAdmin admin;
	// private Configuration conf;
	// private HTable htable;
	HBaseDBHelper dbHelper = HBaseDBHelper.getInstance();
	String tableName = "t_department";

	@Test
	public void createTable() {

		String columnFamilys[] = { "cf1" };

		byte[][] splits = HBaseDBHelper.getHexSplits(1 + "", 10000 + "", 6);
		dbHelper.createTable(tableName, columnFamilys, splits);

	}

	@Test
	public void initDate() {
		for (int i = 3000; i < 300000; i++) {
			String q[] = { "name", "phone", "type", "city", "time" };
			String v[] = { "name" + i, "1810000000" + i, "1", "北京", (new Date()).toLocaleString() };
			dbHelper.insert(tableName, (i) + "", "cf1", q, v);
		}
	}

	@Test
	public void scan() {
		dbHelper.scaner(tableName);
	}
}
